<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input id="input1" type="text" />
		<input id="input2" type="text" />
		<input id="input3" type="text" />
		
		<script>
			
			
			document.getElementById('input1').addEventListener('keydown', function(event) {
			  if (event.key === 'Enter') {
				event.preventDefault();
				
				 const currentElement = document.activeElement;
				  if (currentElement.tagName === 'INPUT' && currentElement.type === 'text') {
				    console.log('当前焦点在输入框:', currentElement.id);
				  } else {
				    console.log('当前焦点不在输入框');
				  }
				  document.getElementById('input2').focus();
			  }
			});
			
			document.getElementById('input2').addEventListener('keydown', function(event) {
			  if (event.key === 'Enter') {
				event.preventDefault();
				document.getElementById('input3').focus();
			  }
			});
		</script>
	</body>
</html>